﻿let btn = document.querySelector(".Addbtn");
let inputs = document.querySelector(".tableType-input");

let TableType = {
    name: ''
 
};


btn.onclick = function () {
    if (inputs.value != "") {
        TableType.name = inputs.value;
        $.post("/Table/AddTableType", TableType).then((res) => {
            console.log(res);

            if (res.code == 0) {
                Peng.Show("添加成功", { type: 'Success' });

                Peng.confirm({ title: '添加成功', content: '返回餐桌管理查看吗?' }, (E) => {

                    Peng.closeconfirm(E);

                    window.location.href = "/index/index";
                });

            } else {
                Peng.Show("添加失败", { type: 'Danger' });

            }
        });
    } else {
        Peng.Show("不能有为空的内容", { type: 'Danger' });
        inputs.focus();
    }

}